package com.wf.classRoomTest;

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;

public class PrintDemo {
    public static void main(String[] args) throws IOException {
        String s = System.getProperty("user.home")+File.separator+ "Desktop"+File.separator+"mpk.txt";
        File file = new File(s);
        file.createNewFile();

        // 创建打印流,指定文件的名称
        try (PrintStream ps = new PrintStream(s)) {
            System.setOut(ps);
            System.out.println("我叫马朋坤");
        }


    }
}
